package com.abaaba.project2.controller;

import com.abaaba.project2.bean.bo.MallConfigBO;
import com.abaaba.project2.bean.vo.AdminConfigVO;
import com.abaaba.project2.bean.vo.BaseRespVo;
import com.abaaba.project2.service.AdminConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Hedgehog
 * @Date 2021/6/5 23:38
 * @Version 1.0
 */
@RestController
@RequestMapping("admin/config")
public class AdminConfigController {

    @Autowired
    AdminConfigService adminConfigService;

    @RequestMapping(value = "mall",method = RequestMethod.GET)
    public BaseRespVo mallGet(){

        //1.本层已通
        //AdminConfigVO adminConfigVO = new AdminConfigVO();
        AdminConfigVO adminConfigVO=adminConfigService.selectMall();

        return BaseRespVo.ok(adminConfigVO);
    }


    @RequestMapping(value = "mall",method = RequestMethod.POST)
    public BaseRespVo mallPost(@RequestBody MallConfigBO mallConfigBO){
        adminConfigService.updateMall(mallConfigBO);

        return BaseRespVo.ok();
    }


}
